package com.zhiyun.test.base.listener;

import org.testng.IAnnotationTransformer;
import org.testng.IRetryAnalyzer;
import org.testng.annotations.ITestAnnotation;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

/**
 * Created by user on 2019-5-27.
 */
public class RetryListener implements IAnnotationTransformer {
  @Override
  public void transform(ITestAnnotation iTestAnnotation, Class aClass, Constructor constructor, Method method) {
    IRetryAnalyzer retry = iTestAnnotation.getRetryAnalyzer();
    if (retry == null) {
      //annotation.setRetryAnalyzer(RetryAnalyzer.class);
      iTestAnnotation.setRetryAnalyzer(RetryFail.class);
    }
  }
}
